home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / PACKAGES / CAS.ZIP / CAS.DOC next >
Text File  |  1996-10-16  |  25KB  |  620 lines

  1.                     CAS -- The 8051 C-Assembler
  2.  
  3. (0) Introduction
  4.    (a) Features
  5.    This is a free full-featured one-pass 8051 assembler, it could very well be
  6. the first one-pass assembler for the popular MCS-51 family of microprocessors.
  7. What you get are the following features:
  8.  
  9.          * Seperately assembleable files. There are two stages of assembly:
  10.              - Pass 1: Creation of object files
  11.              - Pass 1 1/3: Linking of object files
  12.          * Segmentation
  13.              - RELATIVE ADDRESSING supported for all segment types
  14.          * Conditional assembly, with a C-like syntax.  Example:
  15.                 if (Condition) {
  16.                    Assembly instructions...
  17.                 } else {
  18.                    Assembly instructions...
  19.                 }
  20.          * Multiple statements per line with C-like syntax.
  21.          * C-like expression syntax.
  22.          * Command-line options similar to those of *NIX C compilers.
  23.          * An extensive archive of real-life assembly language programs,
  24.            including a multi-tasking library and an 8051 disassembler.
  25.  
  26.    Plus, if you don't want to learn all the elaborate ins and outs of this
  27. tool right away, it is just as easy to use the first time out as any minimal
  28. assembler.
  29.  
  30.    You simply will not find anything this extensive anywhere in the public
  31. domain.  But it's yours, here, for free.
  32.  
  33.    Also under works: a compatible 8051 simulator kit for software developers.
  34. What makes this kit unique is that you can (and usually must) link in your own
  35. C code to define any arbitrary 8051 environment at all.  This gives you the
  36. flexibility to simulate the 8051 in your favorite embedded application and to
  37. even simulate the I/O on a desktop.  A Standard Environment file is included
  38. with the package.
  39.  
  40.    (b) Design Philosophy ... everything is done in one pass.
  41.    A clean distinction is made between the two phases of assembly: (a) creating
  42. segments and formatting image files, (b) mapping segments and resolving
  43. references to variable addresses.
  44.    An assembly language program will normally consist of a set of assembly
  45. language modules (or source files).  Each will typically be named with the
  46. suffix ".s". In addition, there will also be a set of files, with names ending
  47. in ".h" whose purpose is to provide common points of reference for declarations
  48. of objects in or related to modules.  They are incorporated in *.s files using
  49. the "include" directive.
  50.    The first stage of assembly will create OBJECT files, whose names end in
  51. ".o": one for each assembly language module.  For instance, a module named
  52. Kernel.s will be assembled to the object file Kernel.o.
  53.    The second stage will take all the object files that have been created
  54. and LINK them together.  This process will consist mainly of completing the
  55. definitions of variables defined in one module and used in another, and in
  56. mapping the memory segments defined in each module onto a memory image.
  57.  
  58.    These two stages correspond roughly to the first and second pass of a
  59. traditional two-pass assembler.  But there are now two major differences:
  60.    (a) the second stage can now be deferred.  It is possible to assemble object
  61.        files only, and defer the linking phase.  Furthermore, it is possible
  62.        to use the SAME object file in more than one project.
  63.    (b) the second stage is now considerably shortened compared to the second
  64.        pass of a traditional two-pass assembler because object files tend to
  65.        be much smaller than source files and because the assembler no longer
  66.        has to process the assembly language itself by the second stage.
  67.  
  68. (1) Command line arguments
  69.    The cas assembler's command line basically follows that of a typical C
  70. compiler.   In the examples:
  71.  
  72.                (a) cas -c kernel.s
  73.                (b) cas -c math.s data.s stdio.s kernel.s
  74.                (c) cas math.s data.s stdio.s kernel.s
  75.                (d) cas -o data.hex math.o data.s stdio.o kernel.s
  76.  
  77. (a) will assemble the file kernel.s, creating kernel.o.
  78. (b) will assemble all the files listed, creating .o files in the process.
  79.     If a .o file is listed with the -c option, it is ignored.
  80. (c) will assemble all the files listed, as in (b), and then link all the
  81.     corresponding .o files.  The output file will take the same base name
  82.     as the first file listed, and will have the suffix .hex.  Therefore, the
  83.     output in this example will be math.hex.
  84. (d) will do the same as (c), but will name the output file data.hex.
  85.     If a .o file is listed in either of these two command lines  it will be
  86.     ignored during assembly, but will be used during linking.
  87.  
  88. (2) Directives
  89.    The following is a summary of the directives available in this language.
  90.  
  91.    (a) FILE INCLUSION -- include "FILE"
  92.    This command will read the contents of the file named (FILE) into the
  93. current location of the current file.  By convention, include files should
  94. have names ending in ".h" or ".i" and should only consist of declarations.
  95.    Include files generally serve two purposes: to provide a place to store
  96. related constant definitions and declarations, to declare the globally visible
  97. objects of an assembly language module.
  98.  
  99.    (b) Setting current SEGMENT and LOCATION -- seg, at, org
  100.    At any point in scanning a *.s assembly language file, the assembler will
  101. recognize a current segment and current location.  The latter can be referred
  102. to by the user as $.
  103.  
  104.    To see how these items can be set, look at the following examples:
  105.  
  106.                   seg code
  107.                   seg xdata at 0x8000
  108.                   seg xdata org 0x8000
  109.                   org 50
  110.                   at 50
  111.  
  112. The first example sets the current segment to the type "code".  The current
  113. location is left unspecified.  THIS IS HOW RELATIVE ADDRESSING IS INITIATED.
  114. The actual address of the segment's start will not be determined when the
  115. object file is created, but is deferrred until the object file is linked.
  116.  
  117.    Why do things this way?  One simple reason: MODULARITY.  You can now
  118. define your own assembly language module, and convert it into an object
  119. file ready to be linked in with the rest of whatever program might be
  120. using it.  You don't have to worry about the exact address where you
  121. memory segments will be located each time you include this module in a new
  122. program.  This makes it possible to create reuseable libraries of common
  123. assembly language functions.
  124.  
  125.    The second and third example do exactly the same things because "at" and
  126. "org" are synonymous.  The latter is included only for compatibility with
  127. other assembly language programs and for familiarity's sake, but I strongly
  128. recommend you using the former.  It simply reads nicer.
  129.    The effect of this operation is to set the current segment to "xdata" and
  130. the current location to 0x8000.
  131.    The last two examples are equivalent to one another and set the current
  132. location to 50 without changing the current segment.
  133.  
  134.    At the very start of assembly, the current segment is set to the first
  135. segment ("code"), and the address is left indefinite.  When different modules
  136. are linked together, the linker will attempt to take all the segments of each
  137. type and place them in non-overlapping areas of memory, shifting the relative
  138. segments around as needed to accomplish this goal.
  139.  
  140.    What if you want to control the placement of objects, say to exclude
  141. addresses 0 to 4000 hex?  An easy way is to simply write up a module to the
  142. effect:
  143.  
  144. seg code at 0
  145. ds 4000h
  146.  
  147. assemble it seperately and link it in with any program where you want to
  148. reserve this address space.
  149.  
  150.    The linker tries to place your segments in exclusive areas in as tight a
  151. fit as possible.  So this module will result in the address space 0 to 4000
  152. being excluded from the rest of your program.
  153.  
  154.    The segments types supported by this 8051 assembler are the following:
  155.  
  156.         * code --- the 8051 code address space, ranges from 0 to ffff hex.
  157.         * xdata -- the external data address space, same range.
  158.         * data --- the internal data/register space.  Ranges from 0 to ff.
  159.                    Only addresses under 80 hex can be used in mnemonics
  160.                    involving direct addressing.
  161.  
  162. Other segment types are internally used by the assembler.  They are:
  163.  
  164.         * sfr ---- the Special Function Register space -- ranges from 80 to ff.
  165.         * bit ---- the bit addressible address space.  These comprise the
  166.                    individual bits in registers 20(hex) to 2f(hex), and the
  167.                    sfr addresses (hexadecimal) 80, 88, 90, 98, ..., f0, f8.
  168.  
  169. Defining a new segment with one of these types will result in an error.
  170.  
  171.    (c) Defining new LABELS -- LABEL equ Exp, LABEL Type Exp, LABEL:
  172.                               LABEL set Exp, LABEL = Exp
  173.    These operations are defined as follows:
  174.  
  175.               LABEL equ Exp 
  176.                  defines a constant value LABEL and sets it to the value Exp.
  177.               LABEL Type Exp
  178.                  defines a constant address "LABEL" of the indicated type and
  179.                  sets it to the address given by "Exp".  The types recognized
  180.                  by this assembler are: code, xdata, data, sfr, and bit.
  181.               LABEL:
  182.                  sets a constant address "LABEL" to the current address in the
  183.                  current segment.
  184.               LABEL set Exp 
  185.                  defines a variable, LABEL, and sets it to the value Exp.
  186.               LABEL = Exp 
  187.                  the same thing as "set".
  188.  
  189.    The following assembly language fragment is an illustration of these
  190. operations:
  191.  
  192. seg code at 0
  193. Start: ds 0x4000
  194. Size equ $ - Start
  195. End code Start + Size
  196.  
  197.    The first statement sets the current segment and location to "code" and 0.
  198. The next statement is preceded by the label, "Start:".  This is equivalent
  199. to the statement:
  200.  
  201.                              Start code $.
  202.  
  203. What it does is define "Start" as a code address, and sets it to the current
  204. location (which is 0).  Following this is an instruction to reserve 4000(hex)
  205. units (bytes) of storage.  After this operation, the current location is now
  206. 0x4000.
  207.  
  208.    The third instruction sets the numerical constant "Size" to 0x4000 - 0, or
  209. just 0x4000.  The final directive defines a code address with the name "End"
  210. and sets it to the address Start + Size (or just 0x4000).
  211.  
  212.    Variable differ from constants in that they can be redefined.  Constants
  213. cannot be redefined.
  214.  
  215.    (d) Numeric labels
  216.    One can also define anonymous numeric labels, as in the following example:
  217.  
  218. 1: cjne A, #0, 1f
  219.    inc A
  220.    movx @DPTR, A
  221.    inc DPTR
  222.    mov A, @R1
  223.    inc R1
  224.    jz 2f
  225.    sjmp 1b
  226. 1: setb C
  227.    ret
  228. 2: clr C
  229.    ret
  230.  
  231. Each occurrence of "1:" stands for a unique anonymous label, likewise for
  232. "2:".  Any number may be used in this way to denote an anonymous label.
  233.  
  234.    When a label is referenced by the number followed by an "f", then the
  235. first matching numeric label IN THE CURRENT SEGMENT forward of the current
  236. location is being referred to.  In the example above, 1f and 2f refer
  237. respectively to the occurrences of 1: and 2: toward the end of the example.
  238.    When a label is referenced by the number followed by a "b", then the
  239. first matching numeric label IN THE CURRENT SEGMMENT behind the current
  240. location is being referred to.  In the example above, 1b refers to the
  241. 1: at the top of the example.
  242.    Thus, this segment is equivalent to the following:
  243.  
  244. X1: cjne A, #0, Y1
  245.     inc A
  246.     movx @DPTR, A
  247.     inc DPTR
  248.     mov A, @R1
  249.     inc R1
  250.     jz Y2
  251.     sjmp X1
  252. Y1: setb C
  253.     ret
  254. Y2: clr C
  255.     ret
  256.  
  257.    This feature saves you from the burden of defining needless names for
  258. labels that really serve as nothing more than place-holders.
  259.  
  260.    (e) Declaring GLOBAL labels -- global, public
  261.    Any constant directive:
  262.  
  263.               LABEL equ Exp
  264.               LABEL Type Exp
  265.               LABEL:
  266.  
  267. can be prefixed by "global" or "public" to result in:
  268.  
  269.               global LABEL equ Exp
  270.               global LABEL Type Exp
  271.               global LABEL:
  272. or
  273.               public LABEL equ Exp
  274.               public LABEL Type Exp
  275.               public LABEL:
  276.  
  277. What this does is to make these labels visible to modules other than the one
  278. where these labels are defined.  By default, all labels are visible only in
  279. the file where they are used.
  280.  
  281.    (f) Declaring EXTERNAL labels -- extern Type LABEL, ..., LABEL
  282.                                     extern equ LABEL, ..., LABEL
  283.    For each global label defined in a *.s module file, a corresponding
  284. external declaration should be made be made in whatever other module this
  285. label is to be used.  Typically, one will make these and other related
  286. declarations in a *.h file and then INCLUDE this file in whatever module needs
  287. the declarations.  The type must match the type of the label being referenced,
  288. if it is an address, or it must be "equ" if the label referenced was a numeric
  289. constant.
  290.  
  291.    For example if one declared global labels in a module Kernel.s as follows:
  292.  
  293. public STACK_BASE data 0x80
  294.    ...
  295. seg code
  296. public Spawn:
  297.    ....
  298. public Resume:
  299.    ...
  300. one would generally make the corresponding declarations:
  301.  
  302. extern data STACK_BASE
  303. extern code Spawn, Resume
  304.  
  305. in a header file (say, Kernel.h), and then include this file in any source
  306. module where the addresses STACK_BASE and Spawn might be needed.
  307.  
  308.    (g) Memory ALLOCATION -- ds, rb, rw
  309.    The following operations can be used in any segment.  They are generally
  310. used to allocate space for objects and so are generally used in conjunction
  311. with "LABEL:" type definitions.  These are examples:
  312.  
  313. seg code at 0
  314. BASIC_SEG: ds 0x4000
  315.  
  316. seg xdata
  317. Byte: ds 1
  318. ByteArray: rb 5
  319. WordArray: rw 5
  320.  
  321. The first example reserves 0x4000 units (bytes) in the current segment for
  322. the variable BASIC_SEG and then increments the current location by 0x4000.
  323. Basically, this operation behaves as if the assignment "$ = $ + 0x4000" had
  324. just been carried out.
  325.  
  326.    Both "ds" and "rb" are exactly equivalent, but the latter more descriptively
  327. states: reserve single-byte units.  So the second example reserves 1 byte for
  328. the variable "Byte", and 5 bytes for "ByteArray".
  329.  
  330.    NO MEMORY IMAGE IS GENERATED FOR ANY SPACE SKIPPED BY ds/rb/rw.
  331.  
  332.    The third example is equivalent to:
  333.  
  334. WordArray: rb 10
  335.  
  336. Each unit following a "rw" is a word, which consists of two bytes.
  337.  
  338.    (h) Memory FORMATTING - db, dw
  339.    These operations can be used in the code segment only.  They are the only
  340. directives that can generate memory images.  The only other operations that
  341. generate memory image output are the 8051 mnemonics, which likewise are
  342. restricted to the code segment only.
  343.  
  344.    Two purpose served by these operations is mainly to initialize data,
  345. examples:
  346.             ByteArray: db 'a', 'b', 'c', 'd', 'e'
  347.             String:    db "This is a string", 0
  348.  
  349.    In the following examples:
  350.  
  351. db 0x20, "String", 'c'
  352. dw 0x1234, 0x5678
  353.  
  354. the first operation lays out the byte 0x20 and equivalent character codes
  355. for 'S', 't', 'r', 'i', 'n', 'g', and 'c' in that order.  The current
  356. location is then increment by 8 to the location following the last item.
  357.  
  358. The second operation is equivalent to the following:
  359.  
  360. db 0x12, 0x34, 0x56, 0x78
  361.  
  362. It formats 2-byte word units into memory.
  363.  
  364. Both of the operations: db, and dw can be followed by a comma-seperated series
  365. of numeric values or addresses.  In addition, db can accept strings, as shown
  366. in the examplex above.
  367.  
  368.    (i) CONDITIONAL assembly -- if (Ex) ST, if (Ex) ST else ST
  369.    These statements are used to selectively assemble different sets of
  370. statements. For example
  371.  
  372. if (STAND_ALONE) {
  373.    at 0x03
  374.       mov R0, #SP_IE0
  375.       acall Pause
  376.    reti
  377. } else {
  378.    at 0x4003
  379.       pop PSW
  380.       mov R0, #SP_IE0
  381.       acall Pause
  382.    reti
  383. }
  384.  
  385. will assemble the first set of statements (at 0x03 ... reti) if the label
  386. STAND_ALONE is anything other than 0, and the second set (at 0x4003...reti) if
  387. the label is 0.
  388.  
  389.    An example with the exact same effect could be written as:
  390.  
  391. if (STAND_ALONE) SEG equ 0; else SEG equ 0x4000
  392. at SEG + 3
  393.    if (!STAND_ALONE) pop PSW
  394.    mov R0, #SP_IE0
  395.    acall Pause
  396. reti
  397.  
  398. Both the if and else part of the conditional will accept only one statement.
  399. If more than one statement needs to be included, as in the first example, then
  400. they can be grouped within curly braces.
  401.  
  402.    (j) Statement GROUPING -- { ... }, multiple statements on a line.
  403.    Any sequence of statement included within a matching set of curly brackets
  404. is treated as a single statement.  It can then be used in the body of any
  405. conditional just like any single statement can.
  406.  
  407. SPECIAL NOTES ON STATEMENT FORMATTING:
  408.    (A) ALL STATEMENTS (a) THROUGH (h) MUST END IN SEMICOLONS.
  409. However, this semicolon can be elided if it is the last item on a line.  This
  410. allows compatibility with more traditional one-statement-on-a-line type
  411. assemblers.  So normally, you don't have to even concern yourself with this
  412. if you adhere to one-statement per line style.
  413.  
  414.    (B) A BASIC STATEMENT ((a) THROUGH (h)) MUST BE WRITTEN ALL ON ONE LINE
  415. It cannot be split up into two or more lines.
  416.  
  417.    (C) ALL COMMENTS ARE IN C++ STYLE.
  418. Many assemblers use the semicolon to initiate comments.  I have decided
  419. against this feature in favor of making this assembler more compatible with C++
  420. syntax.  Comments occur in the following two forms:
  421.  
  422.            (a) Anything included between a matching pair /* ... */
  423.            (b) Anything included between a // and end of line.
  424.  
  425. However, for increased compatibility, I also allow the following format:
  426.  
  427.            (c) Anything included between a ;; and end of line.
  428.  
  429. My personal style is to precede comments with a ;;;, so none of this impinges
  430. on the software included in the archive with the assembler.
  431.  
  432.    There is a short C-program included that will blindly convert all single
  433. semicolons to double semicolons.  Since I've observed that semicolons rarely
  434. occur inside string or character constants in actual 8051 programs, this should
  435. ALMOST always be sufficient to resolve any incompatibilities with your older
  436. assembly language programs.
  437.  
  438.    (n) What goes in a *.s file, what goes in a *.h file?
  439.    Generally speaking, declarations should be placed in a *.h header file.
  440. The design of this assembler (especially with it being a one-pass assembler) is
  441. intended to support this usage.  Any of the following is a declaration:
  442.  
  443.       (c) Defining new LABELS -- LABEL equ Exp, LABEL Type Exp
  444.       (f) Declaring EXTERNAL labels -- extern Type LABEL, ..., LABEL
  445.                                        extern equ LABEL, ..., LABEL
  446.  
  447. Declarations only meant to be accessed within one module should be made inside
  448. that module, instead of out in a header file.
  449.  
  450. The following should be used only in *.s files, as they are generally
  451. (a) used to create memory images, (b) used to define non-global objects, or
  452. (c) used to define address values:
  453.  
  454.       (a) FILE INCLUSION -- include FILE
  455.       (b) Setting current SEGMENT and LOCATION -- seg, at, org
  456.       (c) Defining new LABELS -- LABEL:
  457.       (d) Numeric labels
  458.       (e) Declaring GLOBAL labels -- global
  459.       (g) Memory ALLOCATION -- ds, rb, rw
  460.       (h) Memory FORMATTING - db, dw
  461.  
  462. The last two items are generally used in many different contexts, and so can be
  463. used anywhere:
  464.  
  465.       (i) CONDITIONAL assembly -- if (Ex) ST, if (Ex) ST else ST
  466.       (j) Statement GROUPING -- { ... }
  467.  
  468. (3) Expressions
  469.   (a) Operators
  470.    The syntax is the same as in C.  The following operations are defined:
  471.  
  472. BIT-WISE:       ~, &, ^, |, <<, >>
  473. BOOLEAN:        !, &&, ||, <, <=, >, >=, ==, !=
  474. CONDITIONAL:    ? :
  475. ARITHMETIC:     prefix + and -, +, -, *, /, %
  476. CONVERSIONS:    high, low, by
  477. BIT CONVERSION: .
  478.  
  479.    The operator precedences are all the same as in C.
  480.  
  481.    The latter two groups, not defined in C, are described in more detail
  482. below.  The operator high, and low have the same precedence as all the other
  483. prefix operators (+, -, !, and ~).  The operators "by" and "." have the lowest
  484. precedence of all infix operators, so for example
  485.  
  486.                             A * B by C
  487. is resolved as:
  488.                             A * (B by C)
  489.  
  490. and
  491.                              A.B + C
  492. as:
  493.                             (A.B) + C
  494.  
  495.   Parentheses may be used to enclose expressions as in C, for example:
  496.  
  497.                     A + ((B << 2)&(C >> 3))
  498.  
  499.    (b) CONVERSIONS ... high X, low X, H by L
  500.    The following examples illustrate these operations:
  501.  
  502.         high 1234h         (result: 12h .. the upper byte of the word 1234h)
  503.         low  1223h         (result: 34h .. the lower byte of the word 1234h)
  504.         12h by 34h         (result: 1234h)
  505.  
  506.    (c) BIT-CONVERSION ... Dir.Pos
  507.    This is an 8051-specific operation related to the bit-addressing structure of
  508. the processor.   The first argument represents a direct data register (of type
  509. "data" and value < 80h, or type "sfr" and value >= 80h).  The second represents
  510. a bit position (0, through 7).
  511.    The register, Dir, must be bit addressible.  These include only:
  512.  
  513.           data; 20h - 2fh
  514.           sfr:   80h,  88h,  90h,  98h, 0a0h, 0a8h, 0b0h, 0b8h,
  515.                 0c0h, 0c8h, 0d0h, 0d8h, 0e0h, 0e8h, 0f0h, 0f8h
  516.  
  517. The sfr registers and bit positions generally have meanings defined by the
  518. manufacturer of the 8051 processor and vary between different versions of the
  519. 8051.  They are not generally free to be defined by the programmer for
  520. arbitrary use.  Most of them control or monitor the internal 8051 peripherals.
  521.  
  522.    (d) LOCATION COUNTER -- $
  523.    A variable address that denotes the current location within the current
  524. segment.  NOTE:
  525.  
  526.                      dw $, $ - 2, $ - 4
  527. IS EQUIVALENT TO:
  528.                      dw $; dw $ - 2; dw $ - 4
  529. which is equivalent to:
  530.                   1: dw 1b; dw 1b; dw 1b
  531.  
  532. The location counter advances in the middle of a dw or db.
  533.  
  534.    (e) NUMERIC CONSTANT
  535.    This assembler accepts both C numeric syntax, as well as the Intel
  536. numeric syntax.  The relation between the (extended) C notation and
  537. Intel notation is illustrated below:
  538.  
  539.           HEXADECIMAL: 0xa44f = 0a44fh
  540.                        0x23   = 23h
  541.           DECIMAL:     23     = 23
  542.                        23     = 23d
  543.           OCTAL:       034    = 34q
  544.                        056    = 56o
  545.           BINARY:      0b1001 = 1001b
  546.  
  547. Upper case may be used anywhere lower case is used, so the above can be written
  548. as:
  549.           HEXADECIMAL: 0XA44F = 0A44FH
  550.                        0X23   = 23H
  551.           DECIMAL:     23     = 23
  552.                        23     = 23D
  553.           OCTAL:       034    = 34Q
  554.                        056    = 56O
  555.           BINARY:      0B1001 = 1001B
  556.  
  557.    (f) LABELS
  558.    Labels may consist of any sequence of letters, the _, and digits, not
  559. starting in a digit.  As with numbers, labels are CASE INSENSITIVE.  So
  560. all of the following are equivalent:
  561.  
  562.                   PPC, PPc, Ppc, pPC
  563.  
  564. (4) Referencing Expressions
  565.    At any time during assembly, a label may be in one of 3 states:
  566.         (a) DEFINED and ABSOLUTE:
  567.             This is either a numeric label, or a label denoting an address
  568.             whose actual value is known.
  569.         (b) DEFINED and RELATIVE:
  570.             This is a label denoting an address whose location within its
  571.             segment is known, bot with the segment being relative.
  572.         (c) UNDEFINED:
  573.             This is a label that is either defined elsewhere in another file,
  574.             or defined later on in the file currently undergoing processing.
  575.  
  576.    The following restrictions hold when using expressions:
  577.       * Only ABSOLUTE labels can be used in any of the directives:
  578.               at/org,
  579.               ds/rb, rw
  580.               if (...)
  581.  
  582.       * Only DEFINED labels can be used on the right-hand side of any of the
  583.         follwing directives:
  584.              Label equ Exp,
  585.              LABEL Type Exp
  586.              LABEL set Exp, LABEL = Exp
  587.  
  588.       * Any expression can be used with any image generating statement:
  589.              Mnemonics
  590.              db, dw
  591.  
  592. If the expression's value is not known at the time of assembly, then the
  593. corresponding location in the image is zeroed out.  If the expression's value
  594. becomes known by the time the file is processed, the assembler will go back
  595. and fill in the zero with the appropriate value(s).
  596.  
  597. (5) Bugs (or "features")
  598.    (a) There is no way to tell the assembler to locate relatively addressed
  599.        data registers in the directly addressible space.  Consequently you
  600.        may receive numerous errors during the linking phase telling you that
  601.        such and such registers cannot be directly addressed.
  602.  
  603.        There are basically 2 ways to resolve this: (1) give the registers
  604.        absolute addresses, (2) try listing the files in which these registers
  605.        are defined first.  The linker maps relative segments from the files
  606.        in the order you list those files.
  607.  
  608.        In the makefile of the sample program provided (in 8051/assem/data), 
  609.        the linking phase is done with the command line:
  610.  
  611.                     cas -o math.o data.o stdio.o kernel.o
  612.  
  613.        This ordering resolves the problem.
  614.  
  615.    (b) The assembler won't recognize UNIX-style newlines on a DOS.  Therefore,
  616.        a conversion utility (nl.c) has been provided.
  617.  
  618.    (c) No run-time checks are made against the object files processed.  A
  619.        corrupt object file will crash the assembler during the linking phase.
  620.